﻿#region Includes
using System;
using System.Runtime.InteropServices;
#endregion

namespace GingerGL.Graphics.Models.BSP
{
    //------------------------------------------------------------//
    /// <summary>
    /// face as found in the file
    /// </summary>
    [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
    public struct BSPFace
    {
        //--------------------------------------------------------//
        #region Variables
        public Int32 Texture;
        public Int32 Effect;
        public Int32 Type;
        public Int32 FirstVertexIndex;
        public Int32 NumVertices;
        public Int32 FirstMeshIndex;
        public Int32 NumMeshIndices;
        public Int32 LightmapIndex;
        
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        public Int32[] LightmapStart, LightmapSize;
        
        [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.R4, SizeConst = 3)]
        public float[] LightmapOrigin, sTangent, tTangent, Normal;
        
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        public Int32[] PatchSize;

        static public readonly int SizeInBytes = sizeof(int) * 14 + sizeof(float) * 12;
        #endregion
        //--------------------------------------------------------//
    }
    //------------------------------------------------------------//
}
